<div id="form"></div>
<script>
var grid;
var frm=$("#form").ajajform({
	header: null,
	footerButtons: [
		{ value: "{{!button_prev_page}}", click: function() {} },
		{ value: "{{!button_next_page}}", click: function() {} },
		{ value: "{{!button_add}}", click: function() {} }
	]
});
var cols={{JSON:browser.ajajform_columns}};
if ({{browser.has_pk}}) {
	cols[0].click=function(grid,rownum,col,row) {}
}
grid=frm.ajajform("insertWidget",null,null,{
	type: "grid",
	title: "{{!title}} {{browser.table_name}}",
	name: "table",
	rowSelection: true,
	rowClasses: [{
		name:"row",
		columns: cols
	}]
});
function show_rows(rows) {
	// TODO clear table
	for (var i=0;i<rows.length;i++) {
		var r=rows[i];
		grid.ajajform_grid("insertRow",null,{rowClass: "row",cells:r.cells,id:r.id});
	}
}
show_rows({{JSON:browser.rows}});
</script>

